<template>
	<view>
		<view class="grid-box">
			<view class="u-flex">
				<view class="u-m-r-20"><u-icon name="clock" size="80" :color="$u.color.infoDark"></u-icon></view>
				<view class="u-flex-1">
					<view class="head-title u-m-b-10"><text>{{orderForm.state}}</text></view>
					<view class="tips-txt"><text>订单已取消</text></view>
				</view>
				<view class="">
					<u-image :src="orderForm.barcode" width="80rpx" mode="widthFix" @click="seePhoto(orderForm.barcode)"></u-image>
				</view>
			</view>
		</view>
		<!-- <view class="grid-box">
			<view class="msg-box">
				<view class="pack">
					<view class="item" @click="goMap(orderForm.store.lat,orderForm.store.lng,orderForm.store.name,orderForm.store.address)">
						<view class="name u-font-32 u-m-b-10">{{orderForm.store.name}}</view>
						<view class="text u-line-1" @click.stop="call(orderForm.store.telephone)"><text class="u-font-28 u-tips-color"><u-icon name="phone-fill"></u-icon>{{orderForm.store.telephone}}</text></view>
					</view>
					<view class="u-p-l-20 u-p-r-20 u-text-center">
						<text class="iconfont icon-daoda u-font-60 u-tips-color"></text>
						<view>
							<text class="u-tips-color u-font-24">{{orderForm.isoutbound?'出库':'移库'}}</text>
						</view>
					</view>
					<view class="item u-text-right" @click="goMap(orderForm.packstation.lat,orderForm.packstation.lng,orderForm.packstation.name,orderForm.packstation.address)">
						<view class="name u-font-32 u-m-b-10">{{orderForm.packstation.name}}</view>
						<view class="text u-line-1" @click.stop="call(orderForm.packstation.telephone)"><text class="u-font-28 u-tips-color"><u-icon name="phone-fill"></u-icon>{{orderForm.packstation.telephone}}</text></view>
					</view>
				</view>
			</view>
		</view> -->
		<view class="grid-box">
			<view class="u-table-box">
				<view class="head-title u-m-b-20"><text>查看站点出库明细(共{{orderForm.store.length}}个)</text></view>
				<u-collapse :item-style='{"border-bottom":"1px solid rgb(220, 223, 230)"}'>
					<u-collapse-item :title="item.store.name" v-for="(item,index) in orderForm.store" :key="index">
						<goods-list :orderId="orderId" :deliverdetails="item.details"></goods-list>
					</u-collapse-item>
				</u-collapse>
			</view>
			<view class="total">
				<view class="u-flex">
					<text class="text u-flex-1 u-text-left">出库总量：{{orderForm.weight}}KG</text>
					<text class="text u-flex-1">出库总价值：{{orderForm.amount}}元</text>
				</view>
			</view>
		</view>
		<view class="grid-box" v-if="orderForm.remarks">
			<view class="head-title u-m-b-20"><text>备注</text></view>
			<view style="padding: 10px;border-color: rgb(220, 223, 230);text-align: left;border-radius: 4px;border: 1px solid #dcdfe6;min-height: 62px;">{{orderForm.remarks}}</view>
		</view>
		<view class="grid-box">
			<view class="head-title u-m-b-20"><text>订单信息</text></view>
			<view class="msg-box">
				<view class="item">
					<text class="label">订单编号：</text>
					<view class="text">{{orderForm.number}}</view>
				</view>
				<view class="item">
					<text class="label">出库时间：</text>
					<view class="text">{{$u.timeFormat(orderForm.createddatetime, 'yyyy-mm-dd hh:MM:ss')}}</view>
				</view>
				<view class="item">
					<text class="label">完结时间：</text>
					<view class="text">{{$u.timeFormat(orderForm.endtime, 'yyyy-mm-dd hh:MM:ss')}}</view>
				</view>
				<view class="item">
					<text class="label">结算金额：</text>
					<view class="text">{{orderForm.amount}}元</view>
				</view>
			</view>
		</view>
		
		<view class="navigation">
			<view class="right">
				<u-button class="navbtn" @click="back">返回</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		props:{
			orderId: 0,
			orderForm: {}
		},
		data() {
			return {
				// 拍照
				fileList: [],
				// 装车提交
				proves: [],
				packDetailsList: [],

				// 装车证明图片列表
				endProves: []
			}
		},
		computed: {
			...mapState({
				header: state => state.Authorization
			})
		},
		methods: {
			// 查看地图
			goMap(lat,lng){
				uni.navigateTo({
					url: `/pages/brother/order/views/map/map?lat=${lat}&lng=${lng}`
				})
			},
			// 订单详情
			detailsOrder(id){
				uni.navigateTo({
					url: '/pages/brother/order/views/views?id='+id
				})
			},
			getDetails(id){
				this.$u.get('Brother/DeliverOrder/Details?id='+id).then((res)=>{
					this.orderForm = res
				})
			},
			seePhoto(url){
				let img = this.fileURL + url
				uni.previewImage({
					current: 0,
					urls: [img]
				});
			},
			// 打电话
			call(phone){
				uni.makePhoneCall({
					phoneNumber:phone
				})
			},
			back(){
				uni.redirectTo({
					url: '/pages/brother/outOrder/outOrder'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.u-color-orange{
		color: $u-color-orange;
	}
	// 宫格展示
	.grid-box {
		background-color: #fff;
		margin: 0 30rpx;
		padding: 30rpx;
		border-radius: 24rpx;
		margin-top: 30rpx;
		box-shadow: $u-color-border-shadow;
		.head-title{
			font-size: 32rpx;
			display: flex;
			justify-content: space-between;
			.more{
				color: $u-color-blue;
			}
		}
		.tips-txt{
			color: $u-tips-color;
			font-size: 24rpx;
		}
	}
	// 订单
	.order {
		// width: 690rpx;
		// background-color: #ffffff;
		// margin: 30rpx auto;
		// border-radius: 30rpx;
		// box-sizing: border-box;
		// padding: 30rpx;
		// font-size: 28rpx;
		// box-shadow: $u-color-border-shadow;
		.top {
			display: flex;
			justify-content: space-between;
			.left {
				display: flex;
				align-items: center;
				.store {
					margin: 0 10rpx;
					font-size: 32rpx;
					font-weight: bold;
				}
			}
			.right {
				color: $u-type-warning-dark;
			}
		}
		.item {
			display: flex;
			margin: 20rpx 0 0;
			justify-content: space-between;
			.left {
				margin-right: 20rpx;
				image {
					width: 160rpx;
					height: 160rpx;
					border-radius: 10rpx;
				}
			}
			.content {
				.title {
					font-size: 28rpx;
					line-height: 50rpx;
				}
				.type {
					margin: 10rpx 0;
					font-size: 24rpx;
					color: $u-tips-color;
				}
				.delivery-time {
					color: $u-tips-color;
					font-size: 24rpx;
				}
			}
			.right {
				margin-left: 10rpx;
				padding-top: 20rpx;
				text-align: right;
				.decimal {
					font-size: 24rpx;
					margin-top: 4rpx;
				}
				.number {
					color: $u-tips-color;
					font-size: 24rpx;
				}
			}
		}
		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;
			.total-price {
				font-size: 32rpx;
				color: $u-color-orange;
			}
		}
		.time{
			font-size: 24rpx;
			margin: 20rpx 0;
			line-height: 40rpx;
		}
		.bottom {
			display: flex;
			margin-top: 40rpx;
			padding: 0 10rpx;
			justify-content: space-between;
			align-items: center;
			.btn {
				line-height: 52rpx;
				width: 160rpx;
				border-radius: 26rpx;
				border: 2rpx solid $u-border-color;
				font-size: 26rpx;
				text-align: center;
				color: $u-type-info-dark;
				padding: 0 10rpx;
			}
			.evaluate {
				color: $u-type-warning-dark;
				border-color: $u-type-warning-dark;
			}
		}
	}
	// 按钮栏
	.navigation {
		display: flex;
		margin-top: 30rpx;
		border: solid 2rpx #f2f2f2;
		background-color: #ffffff;
		position: sticky;
		bottom: 0;
		z-index: 99;
		.right {
			display: flex;
			font-size: 28rpx;
			align-items: center;
			flex: 1;
			justify-content: space-around;
			padding: 20rpx;
			.navbtn{
				width: 100%;
				margin: 0 10rpx;
			}
			.btn {
				line-height: 66rpx;
				padding: 0 30rpx;
				border-radius: 36rpx;
				color: #ffffff;
				margin: 16rpx 0;
			}
			.cancel {
				margin-right: 30rpx;
				color: $u-tips-color;
			}
			.buy {
				background-color: #ff7900;
			}
		}
	}
	// 拍照
	.upload-box{
		.item{
			display: inline-block;
			margin: 20rpx 10rpx 20rpx 0
		}
	}
	// 
	.u-table-box{
		margin: 20rpx 0;
		.green{
			background-color: $u-color-green;
			color: #fff!important;
		}
		.red{
			background-color: $u-color-red;
			color: #fff!important;
		}
	}
	.total {
		margin-top: 20rpx;
		text-align: right;
		font-size: 24rpx;
		.total-price {
			font-size: 32rpx;
			color: $u-color-orange;
		}
	}

	.u-line{
		border-bottom: 1px solid $u-border-color;
		padding-top: 30rpx;
		margin-bottom: 20rpx;
	}
	
	.pack{
		display: flex;
		align-items: center;
		width: 630rpx;
		margin: 20rpx 0;
		.item{
			display: block;
			width: 200rpx;
			flex: 1;
			
			.name{
				color: $u-color-dark;
			}
			.text{
			}
		}
		// .icon{
		// 	font-size: 60rpx;
		// 	padding: 0 80rpx;
		// 	transform: rotate(90deg);
		// 	color: var(--gray);
		// }
	}
</style>
